package com.web.music.model;

import javax.persistence.*;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

// TODO [done]
// You have to make this class a persistent entity
@Entity
public class Singer extends Artist {

	private String name;
	
	private String cityOfOrigin;
	
	@OneToOne
	@JoinColumn(name = "PERSON_ID")
	@LazyCollection(LazyCollectionOption.FALSE)
	private Person person;
	
	public String getName(){
		return name;
	}

	public String getCityOfOrigin(){
		return cityOfOrigin;
	}

	public void setCityOfOrigin(String cityOfOrigin){
		this.cityOfOrigin = cityOfOrigin;
	}

	public void setName(String name ){
		this.name = name;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	@Override
	public boolean existsArtistPerson(Person person) {
		// TODO Auto-generated method stub
		if (getPerson() != null && person != null) {
			return getPerson().getId().equals(person.getId());
		}
		return false;
	}
	

}
